<!--
 * @Description: 
 * @Version: 2.0
 * @Autor: 刘世琪
 * @Date: 2021-01-12 09:09:06
 * @LastEditors: Seven
 * @LastEditTime: 2021-01-21 20:56:23
-->
<template>
    <div>

        <Header></Header>
        <div class="udlite-container partners">
            <van-cell-group>
                <van-tabs>

                    <van-tab title="钉钉用户名登录">
                    <van-field v-model="username" label="用户名" placeholder="请输入钉钉用户名"></van-field>        
                    </van-tab>

                </van-tabs>

            </van-cell-group>
             <van-button type="primary" @click="login">登&emsp;录</van-button>
        </div>

        <Footer></Footer>

    </div>
</template>

<script>
import axios from 'axios'
import Header from './Header.vue'
import Footer from './Footer.vue'

export default {
    data() {
        return {
            username:''
        }
    },
    components:{Header,Footer},
    methods: {
        login(){
            axios({
                url:'http://127.0.0.1:8000/ding_login/',
                method:'post',
                data:{
                    username:this.username
                }
            }).then(resp=>{
                console.log(resp.data)
                if(resp.data.code == 200){
                    this.$router.push('myindex')
                    localStorage.setItem('username',this.username)
                }
            })
        }
        },
    created() {

    }
}
</script>

<style scoped>

</style>
